﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace StateMachineXNA
{
    static class Input
    {
        public static void Update()
        {
            keyboard_prev = keyboard;
            keyboard = Keyboard.GetState();

            //mouse_prev = mouse;
            //mouse = Mouse.GetState();
        }

        // Keyboard -----------------------------------------------------------------
        static KeyboardState keyboard;
        static KeyboardState keyboard_prev;

        public static bool KeyDown(Keys key)
        { return keyboard.IsKeyDown(key); }

        public static bool KeyPressed(Keys key)
        { return keyboard.IsKeyDown(key) && keyboard_prev.IsKeyUp(key); }

        public static bool KeyReleased(Keys key)
        { return keyboard.IsKeyUp(key) && keyboard_prev.IsKeyDown(key); }

        // Mouse --------------------------------------------------------------------
        //static MouseState mouse;
        //static MouseState mouse_prev;

        //public static bool BtnDown()
        //{ return mouse.LeftButton == ButtonState.Pressed; }

        //public static bool BtnPressed()
        //{ return mouse.LeftButton == ButtonState.Pressed && mouse_prev.LeftButton == ButtonState.Released; }

        //public static bool BtnReleased()
        //{ return mouse.LeftButton == ButtonState.Released && mouse_prev.LeftButton == ButtonState.Pressed; ; }
    }
}
